﻿using System.Windows;
using System.Windows.Controls;

namespace PhotoGallery.Controls
{
    public class ExtendedControl : UserControl
    {
        TextBlock _textBlock;

        public ExtendedControl()
        {
            _textBlock = new TextBlock();
            _textBlock.Text = "Hello World";
            this.Content = _textBlock;
        }

        #region Property Text

        public string Text
        {
            get { return (string)GetValue(TextProperty); }
            set { SetValue(TextProperty, value); }
        }

        public static readonly DependencyProperty TextProperty =
            DependencyProperty.Register(
                "Text", 
                typeof(string), 
                typeof(ExtendedControl), 
                new PropertyMetadata("Hello World", OnTextPropertyChanged));
        
        private static void OnTextPropertyChanged(
            DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            ((ExtendedControl)sender)._textBlock.Text = (string)e.NewValue;
        }

        #endregion

        #region Property Speed

        public int Speed
        {
            get { return (int)GetValue(SpeedProperty); }
            set { SetValue(SpeedProperty, value); }
        }

        public static readonly DependencyProperty SpeedProperty =
            DependencyProperty.Register(
                "Speed",
                typeof(int),
                typeof(ExtendedControl),
                new PropertyMetadata(10, OnSpeedChanged));

        private static void OnSpeedChanged(
            DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {

        }

        #endregion

        #region Property Repeat

        public bool Repeat
        {
            get { return (bool)GetValue(RepeatProperty); }
            set { SetValue(RepeatProperty, value); }
        }

        public static readonly DependencyProperty RepeatProperty =
            DependencyProperty.Register(
                "Repeat",
                typeof(bool),
                typeof(ExtendedControl),
                new PropertyMetadata(false, OnRepeatChanged));

        private static void OnRepeatChanged(
            DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {

        }

        #endregion

        #region Property Autostart

        public bool Autostart
        {
            get { return (bool)GetValue(AutostartProperty); }
            set { SetValue(AutostartProperty, value); }
        }

        public static readonly DependencyProperty AutostartProperty =
            DependencyProperty.Register(
                "Autostart",
                typeof(bool),
                typeof(ExtendedControl),
                new PropertyMetadata(false, OnAutostartChanged));

        private static void OnAutostartChanged(
            DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {

        }

        #endregion

        #region Property AnimationType

        public AnimationType AnimationStyle
        {
            get { return (AnimationType)GetValue(AnimationStyleProperty); }
            set { SetValue(AnimationStyleProperty, value); }
        }

        public static readonly DependencyProperty AnimationStyleProperty =
            DependencyProperty.Register(
                "AnimationStyle",
                typeof(AnimationType),
                typeof(ExtendedControl),
                new PropertyMetadata(AnimationType.Bounce, OnAnimationStyleChanged));

        private static void OnAnimationStyleChanged(
            DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {

        }

        public enum AnimationType
        {
            Swirl, Bounce, Jump
        }

        #endregion

        #region Property DialogEditor

        public string DialogEditor
        {
            get { return (string)GetValue(DialogEditorProperty); }
            set { SetValue(DialogEditorProperty, value); }
        }

        public static readonly DependencyProperty DialogEditorProperty =
            DependencyProperty.Register(
                "DialogEditor",
                typeof(string),
                typeof(ExtendedControl),
                new PropertyMetadata("Only a test", OnDialogEditorChanged));

        private static void OnDialogEditorChanged(
            DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {

        }

        #endregion

        #region Property ExtendedEditor

        public string ExtendedEditor
        {
            get { return (string)GetValue(ExtendedEditorProperty); }
            set { SetValue(ExtendedEditorProperty, value); }
        }

        public static readonly DependencyProperty ExtendedEditorProperty =
            DependencyProperty.Register(
                "ExtendedEditor",
                typeof(string),
                typeof(ExtendedControl),
                new PropertyMetadata("Only a test", OnExtendedEditorChanged));

        private static void OnExtendedEditorChanged(
            DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {

        }

        #endregion

        #region Property InlineEditor

        public string InlineEditor
        {
            get { return (string)GetValue(InlineEditorProperty); }
            set { SetValue(InlineEditorProperty, value); }
        }

        public static readonly DependencyProperty InlineEditorProperty =
            DependencyProperty.Register(
                "InlineEditor",
                typeof(string),
                typeof(ExtendedControl),
                new PropertyMetadata("Only a test", OnInlineEditorChanged));

        private static void OnInlineEditorChanged(
            DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {

        }

        #endregion

    }
}
